<div style="padding-left: 200px; width: 986px;">

<?php
			$list_questionID 	= $this->data['question_id'];// danh sách id của câu hỏi
			$list_score    		= $this->data['question_score'];// điểm làm bài của user
			$questionPerPage	= $this->data["question_perpage"];
			$answer_of_user 	= $this->data['question']; // các câu trả lời của user
			$list_score_in_test_table	= $this->data["list_score_in_test_table"];// Điểm của câu hỏi được set trong bài test
			$questionPerPage 	= $questionPerPage==0? 1:$questionPerPage;
			$totalQuestion		= count($list_questionID);
			$totalPage			= (int)($totalQuestion/$questionPerPage);
			$totalPage			= $totalQuestion%$questionPerPage==0?$totalPage:($totalPage+1) ;

?>
<form action="<?php echo BASE_URL;?>/" method="post" >
<table class="table-student-reviewtest-statistic">
	<tr>
		<th>
			Xem lại bài thi
		</th>
	</tr>
	<tr>
		<td class="left">Lớp thi:
		</td>
		<td class="right"><?php echo $this->data['class_obj']['full_name']; ?> 
		</td>
	</tr>
	<tr>
		<td class="left">Người làm:
		</td>
		<td class="right"><?php echo $this->data['user_obj']['firstname']." ".$this->data['user_obj']['lastname'];  ?> 
		</td>
	</tr>
	<tr>
		<td class="left">Bài thi có:
		</td>
		<td class="right"><?php echo$totalPage." trang"; ?> 
		</td>
	</tr>
	<tr>
		<td class="left">Thời gian bắt đầu làm bài:
		</td>
		<td class="right"><?php echo Zend_View_Helper_FormatDate::convertSecondToDateTimeHasHour($this->data['time_start']) ; ?>
		</td>
	</tr>
	<tr>
		<td class="left"> Thời gian nộp bài:
		</td>
		<td class="right"><?php echo Zend_View_Helper_FormatDate::convertSecondToDateTimeHasHour($this->data['time_finished']) ; ?>
		</td>
	</tr>
	<tr>
		<td class="left"> Tổng thời gian làm bài:
		</td>
		<td class="right"> <?php echo Zend_View_Helper_FormatDate::timeBetween($this->data['time_start'], $this->data['time_finished']) ; ?>
		</td>
	</tr>
	<tr>
		<td class="left"> Điểm đạt được: 
		</td>
		<td class="right"> <?php echo $this->data['total_score']; ?>
		</td>
	</tr>	
	<tr>
		<td> Những đáp án được điểm:
		</td>
		<td class="right"><a href="#" onclick="ViewAnswerEatScore(); return false;" >Xem </a> 
		</td>
	</tr>
	<tr>
		<td class="left"> Những đáp án làm sai:
		</td>
		<td class="right"><a href="#" onclick="ViewAnswerNoEatScore(); return false;" >Xem </a> 
		</td>
	</tr>
	<tr>
		<td class="left"> Những câu hỏi chưa làm:
		</td>
		<td class="right"><a href="#" onclick="ViewQuestionNotDone(); return false;" >Xem </a> 
		</td>
	</tr>
	<tr>
		<td class="left"> Xem lại toàn bộ:
		</td>
		<td class="right"><a href="#" onclick="ViewAllAgain(); return false;" >Xem </a> 
		</td>
	</tr>
</table>
<div class="UsecaseTitleView"></div>

<script type="text/javascript" language="javascript">
<!--
$(document).ready(function(){
	firstLoadReviewTest();
	$(".question-container-div").hide()
	$(".separator-question-test").hide()
	var question_per_page = $(".question_per_page").val();
	showPage(0,question_per_page);
	$(".focus-page-test").eq(0).addClass("focus-page-test-active");
});
function focusPage(up_or_down,currentPage){
	page_obj  = $(".focus-page-test-"+up_or_down);
	page_obj.removeClass("focus-page-test-active");
	page_obj.eq(currentPage).addClass("focus-page-test-active");
}
function showPage(currentPage, questionPerpage)
{
	focusPage(1,currentPage);
	focusPage(2,currentPage);
	$(".question-container-div").hide()
	$(".separator-question-test").hide()
	var start  	= currentPage*questionPerpage;
	var end		= start+questionPerpage;
	for(i=start; i< end; i++){
		$(".separator-question-test").eq(i).show();
		$(".question-container-div").eq(i).show();
	}
}
//-->
</script>

<?php		
			$link = "<div class='page_review_test'><font style='font-size: 16px; font-weight: bold; '>Trang: </font> ";
			for($i=0;$i<$totalPage;$i++)
				$link .= "&nbsp;<a href='#' onclick='showPage($i,$questionPerPage); return false;'><span class='focus-page-test-1'> ".($i+1)."</span></a> &nbsp;&nbsp;";
			$link .="</div><hr/>";
			echo $link;
			if(!empty($list_questionID[0])){		
                            foreach($list_questionID as $key=>$list_questionIDItem){ 
                                $answer_of_user_temp = isset($answer_of_user[$list_questionIDItem])?$answer_of_user[$list_questionIDItem]:"";
                                $list_score_temp = isset($list_score[$key])?$list_score[$key]:1;
                                $list_score_in_test_table[$key] = isset($list_score_in_test_table[$key])?$list_score_in_test_table[$key]:1;
                                
                                //echo  $this->viewQuestion($this->data["testID"],$list_questionIDItem,"Câu ".($key+1)." : ",$answer_of_user[$list_questionIDItem],0,0,0,1,-1,$list_score[$key], $list_score_in_test_table[$key] );
                                echo  $this->viewQuestion($this->data['test_id'],
                                        trim($list_questionIDItem),
                                        "Câu ".($key+1)." : ",
                                        $answer_of_user_temp,
                                        $this->review_test,
                                        $this->view_corect,
                                        $this->view_feedback,
                                        $this->view_send_result,
                                        $list_score_temp,
                                        $list_score_in_test_table[$key],
                                        $this->data["state_question_after_dogarade"][$key]
                                        );
                                echo "<span class='separator-question-test'><hr/></span>";
                            }
			
			$link = "<div class='page_review_test'><font style='font-size: 16px; font-weight: bold; '>Trang: </font> ";
			for($i=0;$i<$totalPage;$i++)
				$link .= "&nbsp;<a href='#' onclick='showPage($i,$questionPerPage); return false;'><span class='focus-page-test-2'> ".($i+1)."</span></a> &nbsp;&nbsp;";			
				$link .="</div>";
			echo $link;
			}
?>
<input type="hidden" class="question_per_page" value="<?php echo $questionPerPage; ?>">
<hr/>
</form>
<p align="center">
		 	<input type="button" value="Đóng lại" onclick="window.close()">
</p>
</div>
<script type="text/javascript" language="javascript">

function ViewAnswerEatScore(){
	showPageStudentAfterTest();
	$(".UsecaseTitleView").html('<div class="UsecaseTitleView">Các câu hỏi được điểm</div>');
	$(".answerEatScore").each(function(){
		$(this).show();
		$(this).next(".separator-question-test").show();
	});	
}
function ViewAnswerNoEatScore(){
	showPageStudentAfterTest();
	$(".UsecaseTitleView").html('<div class="UsecaseTitleView">Các câu hỏi làm sai</div>');
	$(".answerNoEatScore").each(function(){
		$(this).find(".ui-state-highlight").removeClass().addClass("ui-state-error");
		$(this).show();
		$(this).next(".separator-question-test").show();
	});
}
function ViewQuestionNotDone(){
	showPageStudentAfterTest();
	$(".UsecaseTitleView").html('<div class="UsecaseTitleView">Các câu hỏi không làm</div>');
	$(".questionNotDone").each(function(){
		$(this).find(".ui-state-highlight").removeClass().addClass("ui-state-active");
		$(this).show();
		$(this).next(".separator-question-test").show();
	});
}
function ViewAllAgain(){
	$(".UsecaseTitleView").html('<div class="UsecaseTitleView">Toàn bộ bài làm</div>');
	$(".WrapperQuestion").show();
	$(".separator-question-test").show();
}

function showPageStudentAfterTest()
{
	$(".page_review_test").hide();
	$(".question-container-div").show();
	$(".separator-question-test").show();
	/*$(".WrapperQuestion").show();*/
	$(".WrapperQuestion").hide();
	$(".separator-question-test").hide();
}

function firstLoadReviewTest(){
	$(".answerNoEatScore").each(function(){
		$(this).find(".ui-state-highlight").removeClass().addClass("ui-state-error");
//		$(this).show();
	//	$(this).next(".separator-question-test").show();
	});
	$(".questionNotDone").each(function(){
		$(this).find(".ui-state-highlight").removeClass().addClass("ui-state-active");
		//$(this).show();
		//$(this).next(".separator-question-test").show();
	});
}

</script>
